package com.lft04.callable;

import com.lft00.common.WebDownloader;

import java.util.concurrent.Callable;

/**
 * Function: 		A {@code LftThread} object With Some FUNCTION.<br/>
 * Reason:   		ADD REASON.<br/>
 * Date:            2021-01-26 22:18<br/>
 * <p>
 * Class Name:      LftThread<br/>
 * Package Name:    com.lft04.callable<br/>
 * @author Laifengting / E-mail:laifengting@foxmail.com
 * @version 1.0.0
 * @since JDK 8
 */
public class LftThread implements Callable<Boolean> { // 第一步：实现 Callable 接口 设置泛型
	/**
	 * 网络图片地址
	 */
	private String url;
	
	/**
	 * 保存的文件名
	 */
	private String name;
	
	public LftThread(String url, String name) {
		this.url = url;
		this.name = name;
	}
	
	/**
	 * 第二步：重写 call() 方法 带返回类型。
	 * @return
	 * @throws Exception
	 */
	@Override
	public Boolean call() throws Exception {
		WebDownloader.downloadFile(url, name);
		System.out.println("下载了文件名为：" + name);
		return Boolean.TRUE;
	}
	
}
